<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
    <!--1、头部-->
    <head th:replace="common/front_fragment::head(归档页面)"></head>

    <!--2、、js引用-->
    <div th:replace="common/front_fragment::myJs">
        <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
        <script src="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.js" th:src="@{/js/semantic.js}"></script>
    </div>

    <!--3、中间内容、底部footer-->
    <body class="bg-front">
        <div class="wrap">
            <div class="main">
                <!--3.1：导航栏-->
                <nav th:replace="~{common/front_fragment::nav(4)}"></nav>

                <!--3.2：中间内容-->
                <div class="m-container-small m-padded-tb-big m-opacity m-phone-opacity">
                    <!--归档内容-->
                    <div class="ui container">  <!--拥有：响应式的效果-->
                        <!--头介绍-->
                        <div class="ui top attached segment border-radius title-front-arch">
                            <div class="ui middle aligned two column grid">
                                <div class="column">
                                    <span class="ui header span-front-font">归档</span>
                                </div>

                                <div class="right aligned column">
                                    <span class="ui header span-front-font">共</span> <span class="span-front-num" th:text="${#arrays.length(blogs)}"> 142 </span> <span class="span-front-font">篇</span>
                                </div>
                            </div>
                        </div>

                        <select class="ui fluid selection attached segment dropdown archives-font" th:onchange="look(this)"  th:unless="${null == blogs || blogs.size() == 0}">
                            <option value="2021" th:each="year:${years}" th:text="${year}" th:value="${year}" th:selected="${currentYear == year}">2021</option>
                        </select>

                        <!--归档时间（及）文章-->
                        <th:block th:unless="${null == blogs || blogs.size() == 0}">
                            <div class="ui fluid vertical menu" th:each="blog : ${blogs}">
                                <a href="" th:href="@{/front/blog/{id}(id=${blog.id})}" target="_blank" class="item"  id="MyArchStripe">
                                <span>
                                     <i class="mini paper plane outline icon icon-color"></i>&nbsp;&nbsp;[[${blog.title}]]
                                     <div class="ui teal basic left pointing label m-padded-tiny font-spacing" th:text="${#dates.format(blog.createTime, 'MM月dd日')}"></div>
                                </span>

                                    <div class="ui blue  basic label m-padded-little font-spacing" th:text="${blog.flag}">原创</div>
                                </a>
                            </div>
                        </th:block>
                    </div>
                </div>
            </div>
        </div>

        <!--3.3：底部footer-->
        <footer th:replace="common/front_fragment::footer"></footer>
    </body>



    <!--4、JS代码：
                    4-1、手机端：菜单点击按钮（JS）
                    4-2、下拉：归档日期
    -->
    <script th:inline="javascript">
        $('.menu.toggle').click(function(){
            $('.m-item').toggleClass('m-mobile-hide');
        });

        function look(o) {
            location.href= "/front/archives/" + o.value;
        }

        $('.ui.dropdown').dropdown({
            on: 'hover'
        });

    </script>
</html>